
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style>

div{background:yellow;color:red;font-size:20px}
</style>
</head>
<body>
<h1>ajax练习</h1>
<div id="mydiv">这里会刷新</div>
<button onclick="ajaxgo()">发送</button>
<script>
var http=new XMLHttpRequest();
var url="user/find?m=csgo&name=temo";
function ajaxgo(){
	http.open("GET",url,true);
	http.send();
}
//事件on  ready准备    state状态    change改变
//readyState
//status
//responseText   返回的文本
http.onreadystatechange=function(){
	 if(http.readyState==4 && http.status==200){
		 console.log(http.responseText);
		 var div=document.getElementById("mydiv");
		 div.innerHTML=http.responseText;
	 }
}
</script>
</body>
</html>